home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-16 | 2.8 KB | 116 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLColor.h
- // Release Version: $ ODF 3 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef SLCOLOR_H
- #define SLCOLOR_H
-
- #ifndef SLGRDEF_H
- #include "SLGrDef.h"
- #endif
-
- // Export or Import functions for CFM-68K [sfu]
-
- #if defined(FW_ODFLIB_IMPORT)
- #pragma import on
- #elif defined(FW_ODFLIB)
- #pragma export on
- #endif
-
- FW_EXTERN_C_BEGIN
-
- //========================================================================================
- // Type definitions
- //========================================================================================
-
- typedef unsigned char FW_RGBComponent;
-
- struct FW_SColor
- {
- unsigned long fRGB;
- };
-
- //========================================================================================
- // Color utilities
- //========================================================================================
-
- inline void FW_PrivSetRGB(FW_SColor& color, FW_RGBComponent r, FW_RGBComponent g, FW_RGBComponent b)
- {
- color.fRGB = (((unsigned long)(r)) | ((unsigned long)(g) << 8) | ((unsigned long)(b) << 16));
- }
-
- inline FW_RGBComponent FW_PrivRGB_R(const FW_SColor& color)
- {
- return (FW_RGBComponent) (color.fRGB);
- }
-
- inline FW_RGBComponent FW_PrivRGB_G(const FW_SColor& color)
- {
- return (FW_RGBComponent) (color.fRGB >> 8);
- }
-
- inline FW_RGBComponent FW_PrivRGB_B(const FW_SColor& color)
- {
- return (FW_RGBComponent) (color.fRGB >> 16);
- }
-
- FW_Boolean operator==(const FW_SColor& color1, const FW_SColor& color2);
- FW_Boolean operator!=(const FW_SColor& color1, const FW_SColor& color2);
-
- inline FW_Boolean operator==(const FW_SColor& color1, const FW_SColor& color2)
- {
- return color1.fRGB == color2.fRGB;
- }
-
- inline FW_Boolean operator!=(const FW_SColor& color1, const FW_SColor& color2)
- {
- return color1.fRGB != color2.fRGB;
- }
-
- //========================================================================================
- // Color conversion functions
- //========================================================================================
-
- #ifdef FW_BUILD_WIN
-
- FW_SColor SL_API
- FW_WinRGBQuadToColor(const RGBQUAD* rgbQuad);
-
- FW_SColor SL_API
- FW_WinRGBTripleToColor(const RGBTRIPLE* rgbTriple);
-
- void SL_API
- FW_WinColorToRGBQuad(FW_SColor rgb, RGBQUAD* rgbQuad);
-
- void SL_API
- FW_WinColorRGBTriple(FW_SColor rgb, RGBTRIPLE* rgbTriple);
-
- #endif
-
- #ifdef FW_BUILD_MAC
-
- FW_SColor SL_API
- FW_MacRGBToColor(const RGBColor* rgbColor);
-
- void SL_API
- FW_MacColorToRGB(FW_SColor rgb, RGBColor* rgbColor);
-
- #endif
-
- FW_EXTERN_C_END
-
- // For CFM-68K [sfu]
-
- #if defined(FW_ODFLIB_IMPORT)
- #pragma import off
- #elif defined(FW_ODFLIB)
- #pragma export off
- #endif
-
- #endif // SLCOLOR_H
-